home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-10-22 | 1.6 KB | 69 lines | [TEXT/CWIE] |
- unit MyExpiry;
-
- interface
-
- uses
- Types;
-
- function ExpiredVersion (cs:longint; notify, expire: integer): boolean;
- { Pass it compdate, and the number of months until it notifies/expires }
-
- implementation
-
- uses
- OSUtils, MyStrings, MyVersionResource, MyEmergencyNotifier, MyUtils;
-
- procedure GetCompiledDate (cd: Str255; var date: longint);
- var
- d: DateTimeRec;
- s: str31;
- p: integer;
- begin
- s := cd;
- p := TPPos('/', s);
- d.day := StrToNum(TPCopy(s, 1, p - 1));
- Delete(s, 1, p);
- p := TPPos('/', s);
- d.month := StrToNum(TPCopy(s, 1, p - 1));
- Delete(s, 1, p);
- d.year := 1900 + StrToNum(s);
- d.hour := 0;
- d.minute := 0;
- d.second := 0;
- DateToSeconds(d, date);
- end;
-
- function ExpiredVersion (cs:longint; notify, expire: integer): boolean;
- var
- date, diff: longint;
- vers: versionRecord;
- begin
- ExpiredVersion := false;
- GetVersion(vers);
- if vers.numericVersion.stage <> $80 then begin
- GetDateTime(date);
- if compsecs > cs then begin
- cs := compsecs;
- end;
- diff := (date - cs) div 2678400;
- if diff >= expire then begin
- EmergencyNotify('This developmental version has expired. Set your clock back, or get a new version');
- ExpiredVersion := true;
- end
- else if diff >= notify then begin
- EmergencyNotify('This developmental version has expired. It will work for a while, and then stop working forever. Get a new version');
- end;
- end;
- end;
-
-
- end.
- GetVersion(vers);
- if vers.devcode <> $80 then begin
- GetDateTime(date);
- GetCompiledDate(cd, cdate);
- GetCompiledDate(compdate, cdate2);
- if cdate2 > cdate then begin
- cdate := cdate2;
- end;
-